<?php ?>
<!--
 * @Author: your name
* @Date: 2021-02-26 14:25:42
* @LastEditTime: 2021-04-09 16:24:10
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /www/dtk_static_www_user_center/html/单页html/首页.html
-->
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="App-Config" content="fullscreen=yes,useHistoryState=yes,transition=yes">
    <meta content="yes" name="apple-mobile-web-app-capable"><meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">

    <link rel="stylesheet" href="/assets/css/message.css">
    <script type='text/javascript' src='/assets/js/message.min.js' id='message'></script>

    <script type="text/javascript" src="https://public.ffquan.cn/lib/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="https://cdn.staticfile.org/vue/2.6.11/vue.min.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/vue-lazyload.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/swiper/js/swiper.min.js"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/taobaoCode/taobaoCode.js?v=1.2.0"></script>
    <script type="text/javascript" src="https://public.ffquan.cn/lib/clipboard.min.js"></script>
    <script src="https://cdn.staticfile.org/moment.js/2.29.1/moment.min.js"></script>
    <link rel="stylesheet" href="https://public.ffquan.cn/lib/swiper/css/swiper.min.css">
    <title>实时疯抢榜</title>
    <!--webview与app通信-->
    <!-- uni 的 SDK -->
    <!-- 需要把 uni.webview.1.5.4.js 下载到自己的服务器 -->
    <script type="text/javascript" src="/assets/js/qqjssdk-1.0.0.js"></script>
    <script type="text/javascript" src="/assets/js/jweixin-1.4.0.js"></script>
    <script type="text/javascript" src="/assets/js/uni-webview-js@0.0.3.js"></script>


    <script type="text/javascript">
        // 待触发 `UniAppJSBridgeReady` 事件后，即可调用 uni 的 API。
        document.addEventListener('UniAppJSBridgeReady', function() {
            console.log('=====================uni.postMessage开始=====================')
        });
    </script>
    <!--webview与app通信结束-->
    <script>
        function isWxClient(){var ua=window.navigator.userAgent.toLowerCase();if(ua.match(/qq/i)=="qq" || ua.match(/MicroMessenger/i)=="micromessenger"||ua.match(/miniProgram/i)=="miniprogramenv/windows"||ua.match(/miniProgram/i)=="miniprogramenv/mac"){return true}else{return false}};
        function isUniApp(){var ua=window.navigator.userAgent.toLowerCase();if(ua.match(/uni-app/i)=="uni-app"){return true;}else{return false;}}
        function isIos(){var ua=window.navigator.userAgent.toLowerCase();if(ua.match(/ipod/i)=="ipod" || ua.match(/iphone/i)=="iphone" || ua.match(/ipad/i)=="ipad"){return true;}else{return false;}}

        function isFrame(){ if (window.frames.length != parent.frames.length) { return true; }else{return false;}}

        var isApp = isUniApp();
        var isWx = isWxClient();
        var isIos = isIos();
        var isH5 = isFrame();

        console.log(isApp);
        console.log(isWx);
        console.log(isIos);
        console.log(isH5);
        //     Qmsg.warning('右上角浏览器内打开',{
        //         html:true
        //     })

        var _config = {
    appKey: '<?php echo $dataoke_appkey; ?>',//此处替换成用户appKey
            jumpGoodsUrl: function (items) {   //默认直接转链
                // 0: 未知 1: 淘宝 2：天猫
                var platform = 0;

                if(items.mallDesc){
                    if(items.mallDesc == '淘宝'){
                        platform = 1;
                    }else if(items.mallDesc == '天猫'){
                        platform = 2;
                    }
                }


                if(isH5){
                    window.open('<?php echo $h5_home . '/#/pages/shop/goods-details/goods-details?'; ?>' + 'dtk_id=' + items.id
                        + '&tk_goodsid=' + items.goodsid + '&tk_platform=' + platform);
                }else{
                    uni.postMessage({
                        data: {
                            action: 'toShopGoods',
                            goodsid: items.goodsid,
                            platform: platform,
                            id: items.id
                        }
                    });
                    if(isWx){
                        uni.navigateBack();
                    }
                }
                return false;
            }
        };
    </script>
    <style>
body{
    margin: 0;padding: 0;
}
        a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:rgba(0,0,0,0);tap-highlight-color:transparent;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}html{font-family:Arial,PingFang SC,-apple-system,BlinkMacSystemFont,Segoe UI,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}
        .list-container{
    position: relative;
    padding-top: 10px;
        }
        .top-bg{
    width: 100%;position: absolute;top:0;
}
        .list-container .tit-img{
    width: 1.84rem;height: 0.36rem;position: relative;margin:.1rem auto .3rem;display: block;
        }
        .list-container .top-nav{
    position: relative;
}
        .list-container .top-nav .swiper-slide{
    padding: 0 .2rem;font-weight: 500;font-size: .3rem;color: hsla(0,0%,100%,.6);position: relative;width: auto;padding-bottom: 8px;
        }
        .list-container .top-nav .swiper-slide.act{
    color:#fff;
}
        .list-container .top-nav .swiper-slide.act::after{
    content: '';width: 50%;border-bottom: 2px solid #fff;position: absolute;bottom: 0px;left: 25%;
        }
        .list-container .updateTime{
    height: .4rem;background: rgba(255,129,70,.9);border-radius: .2rem;display: table;margin: .3rem auto;padding: 0 .2rem;font-size: .22rem;color: #fff;line-height: .4rem;
        }
        .list-container .topThree{
    display: -webkit-flex;display: flex;-webkit-justify-content: center;justify-content: center;
        }
        .list-container .topThree>div {
    width: 2.2rem;height: 3.4rem;background: #fff;border-radius: .14rem;padding: .1rem;position: relative;
        }
        .list-container .topThree>div:nth-child(2) {
-webkit-transform: scale(1.08);transform: scale(1.08);-webkit-transform-origin: bottom;transform-origin: bottom;margin: 0 .2rem;
        }
        .list-container .topThree>div  .productImg {
    position: relative; margin-bottom: .28rem;
        }

        .list-container .topThree>div  .productImg img {
    width: 2rem;height: 2rem;border-radius: .1rem;
        }

        .list-container .topThree>div .sales {
    width: 2rem;height: .34rem; border-radius: .17rem;text-align: center;background: linear-gradient(270deg,#ffa700,#ff4728);box-shadow: 0 0.04rem 0.08rem 0 rgba(255,133,0,.4);
            line-height: .34rem;padding: 0 .18rem;font-size: .2rem;font-family: PingFangSC-Regular,PingFang SC;color: #fff;position: absolute;bottom: -.15rem;
        }

        .list-container .topThree>div  .title {
    white-space: nowrap;text-overflow: ellipsis;overflow: hidden;height: .34rem;font-size: .24rem;font-family: PingFangSC-Regular,PingFang SC;
            color: #333;line-height: .34rem;margin-bottom: .05rem;
        }

        .list-container .topThree>div  .price {
    font-size: .2rem;font-family: PingFangSC-Regular,PingFang SC;color: #fe3738;
        }

        .list-container .topThree>div .currency {
    font-size: .24rem;font-weight: 500;font-family: PingFangSC-Medium,PingFang SC;color: #fe3738;margin: 0 .02rem 0 .06rem;
        }

        .list-container .topThree>div .juanPrice{
    font-size: .34rem;font-weight: 500;color: #fe3738;margin-right: .04rem;font-family: PingFangSC-Medium,PingFang SC;
        }

        .list-container .topThree>div .top{
    width: .46rem;height: .56rem;position: absolute;left: .1rem;top: -.05rem;
        }
        .list-container .topThree>div .top1{
    background: url(…Ob+CHwGmMcUU8zyv9Bk5+SSxFfQ9iKYkMMkRMonlffo/nfFXjFsJKeCaEAAAAASUVORK5CYII=) no-repeat 50%;
            background-size: 100%;
        }
        .list-container .topThree>div .top2 {
    background: url(…nzBJLFlsbvxWST+DYHuY6XfIG5mPwQwQILeD2Cx8RaWv8PpV9fimlJ+gQAAAAASUVORK5CYII=) no-repeat 50%;
            background-size: 100%;
        }
        .list-container .topThree>div .top3{
    background: url(…DMBiTLTYv/NwZbxHc4wjUs8iWqMfgRgmWm4HUI1otH6PgfnT2F8XyX3WAAAAAASUVORK5CYII=) no-repeat 50%;
            background-size: 100%;
        }

        .list-container .lists li {
    width: 7.1rem;height: 2.4rem;background: #fff;border-radius: .16rem;padding: .1rem;margin: .2rem auto 0;
        }

        .list-container .lists li .productImg{
    float: left;margin-right: .2rem;position: relative;
        }

        .list-container .lists li .productImg .imgPerch {
    width: 2.2rem;height: 2.2rem;border-radius: .1rem;
        }

        .list-container .lists li .productImg img {
    width: 2.2rem;height: 2.2rem;border-radius: .1rem;
        }

        .list-container .lists li .productImg .top{
    width: .5rem;height: .7rem;
            background: url() no-repeat 50%;
            background-size: .5rem .7rem;position: absolute;top: 0;left: 0;display: -webkit-flex;display: flex;-webkit-flex-direction: column;
            flex-direction: column;-webkit-align-items: center;align-items: center;color: #fff;padding-top: .02rem;line-height: .27rem;
        }
        .list-container .lists li .productImg .top span {
    font-size: .16rem;font-family: ArialMT;
        }
        .list-container .lists li .title{
    height: .36rem;font-size: .26rem;font-family: PingFangSC-Regular,PingFang SC;color: #333;line-height: .36rem;overflow: hidden;text-overflow: ellipsis;
            white-space: nowrap; margin-bottom: .22rem;display: -webkit-flex;display: flex;-webkit-align-items: center;align-items: center;
        }
        .list-container .lists li .title .shoplabel {
    height: .26rem;float: left;
        }

        .list-container .lists li .title .shoplabel img {
    height: 100%;display: block;
}
        .list-container .lists li .title span {
    overflow: hidden;text-overflow: ellipsis;white-space: nowrap;margin-left: .05rem;
        }

        .list-container .lists li .lable{
    display: -webkit-flex;display: flex;-webkit-flex-direction: row;flex-direction: row;-webkit-flex-wrap: nowrap;flex-wrap: nowrap;-webkit-align-items: center;
            align-items: center;-webkit-justify-content: flex-start;justify-content: flex-start;
        }

        .list-container .lists li .lable .coupon{
    height: .3rem;background: linear-gradient(90deg,#ff8873,#ff4f4f);border-radius: .04rem;display: inline-block;line-height: .3rem;padding: 0 .06rem 0 .02rem;
            font-size: .19rem;font-family: PingFangSC-Regular,PingFang SC;color: #fff;display: -webkit-flex;display: flex;-webkit-align-items: center;align-items: center;
            width: -webkit-max-content;width: -moz-max-content;width: max-content;
        }

        .list-container .lists li .lable .coupon span {
    display: inline-block;font-size: .18rem;font-family: PingFangSC-Regular,PingFang SC;font-weight: 400;color: #ff5351;line-height: .19rem;padding: 2px .04rem;background: #fff;
            border-radius: .02rem 0 0 .02rem;text-align: center;margin-right: .06rem;
        }

        .list-container .lists li .price{
    font-size: .2rem;font-family: PingFangSC-Regular,PingFang SC;color: #fe3738;
        }

        .list-container .lists li .price .currency{
    font-size: .24rem;font-weight: 500;font-family: PingFangSC-Medium,PingFang SC;color: #fe3738;margin: 0 .02rem 0 .06rem;
        }

        .list-container .lists li .price .juanPrice {
    font-size: .34rem;font-weight: 500;color: #fe3738;margin-right: .04rem;font-family: PingFangSC-Medium,PingFang SC;
        }
        .list-container .lists li .price .originPrice {
    text-decoration: line-through;height: .26rem;font-size: .2rem;font-family: PingFangSC-Regular,PingFang SC;color: #999;line-height: .26rem;margin-left: .1rem;
        }

        .list-container .lists li .btn{
    width: 4.4rem;height: .56rem;background: #ffeee6;border-radius: 0 2rem 2rem 0;margin-left: 2.4rem;font-size: .22rem;font-family: PingFangSC-Regular,PingFang SC;color: #893c11;
            line-height: .56rem;padding-left: .22rem;position: relative;
        }

        .list-container .lists li .btn span {
    height: .36rem;font-size: .26rem;font-family: PingFangSC-Medium,PingFang SC;font-weight: 500;color: #ff5b00;line-height: .36rem;margin: 0 .04rem;display: inline-block;
        }

        .list-container .lists li .btn .suffix{
    background:url() no-repeat 50%;
            background-size: 100%;width: 1.64rem;height: .72rem;position: absolute;right: -.1rem;top: -.05rem;font-size: .24rem;font-family: PingFangSC-Medium,PingFang SC;
            font-weight: 500;color: #fff;line-height: .65rem;text-align: center;
        }
        .list-container .card-block{
    padding-top: 15px;
        }
        .sys{
    width: 100%;
    height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            z-index: 9999999;
            background: rgba(0, 0, 0, 0.6)
            url('https://sr.ffquan.cn/dtk_yunying/20210803/c44albf6vrkd4bd59itg0.png')
            center center no-repeat;
            background-size: 2.4rem auto;
        }
    </style>
</head>

<body>

    <img src="https://jpdy.ffquan.cn/static/header_bg.12963398.png" class="top-bg" alt="">

    <div class="list-container" id="fqList">
        <div v-if="sys == null" class="sys"></div>
<!--        <img src="" class="tit-img" alt="">-->

        <div class="swiper-container top-nav">
            <div class="swiper-wrapper">
                <div class="swiper-slide" :class="actIndex==index?'act':''" v-for="(item,index) in cateList" :key="index" @click="chooseCate(index,item.id,item.type)">{{item.title}}</div>
</div>
</div>

<div class="updateTime"><i type="shizhong" class="DTKiconfont shizhong shizhong___3DUi1"></i>距离下次排名更新还有 {{mins}} 分 {{ss}} 秒</div>



<div class="swiper-container card-block">
    <div class="swiper-wrapper">
        <div class="swiper-slide swiper-no-swiping">
            <div class="topThree">
                <div v-for="(item,index) in goodsList" :key = "index" v-if="index==1"  @click="handleCdetailFavorite(item)">
                    <a>
                        <div class="productImg">
                            <img :src="imgFomate(item.pic)" class="fadeIn ">
                            <div class="sales" style="padding: 0px;">2小时疯抢{{digitalAbbNumber({num:item.salesNum})}}</div>
                        </div>
                        <div class="title">{{item.dtitle}}</div>
                        <div class="price">
                            <span class="currency">¥</span>
                            <span class="juanPrice">{{item.jiage}}</span>
                            <span>券后</span>
                        </div>
                        <div class="top top2"></div>
                    </a>
                </div>

                <div v-for="(item,index) in goodsList" :key = "index" v-if="index==0"  @click="handleCdetailFavorite(item)">
                    <a>
                        <div class="productImg">
                            <img :src="imgFomate(item.pic)" class="fadeIn ">
                            <div class="sales" style="padding: 0px;">2小时疯抢{{digitalAbbNumber({num:item.salesNum})}}</div>
                        </div>
                        <div class="title">{{item.dtitle}}</div>
                        <div class="price">
                            <span class="currency">¥</span>
                            <span class="juanPrice">{{item.jiage}}</span>
                            <span>券后</span>
                        </div>
                        <div class="top top1"></div>
                    </a>
                </div>

                <div v-for="(item,index) in goodsList" :key = "index" v-if="index==2"  @click="handleCdetailFavorite(item)">
                    <a>
                        <div class="productImg">
                            <img :src="imgFomate(item.pic)" class="fadeIn ">
                            <div class="sales" style="padding: 0px;">2小时疯抢{{digitalAbbNumber({num:item.salesNum})}}</div>
                        </div>
                        <div class="title">{{item.dtitle}}</div>
                        <div class="price">
                            <span class="currency">¥</span>
                            <span class="juanPrice">{{item.jiage}}</span>
                            <span>券后</span>
                        </div>
                        <div class="top top3"></div>
                    </a>
                </div>

            </div>

            <ul class="lists">
                <li v-for="(item,index) in goodsList" :key = "index" v-if="index > 2" @click="handleCdetailFavorite(item)">
                    <a>
                        <div class="productImg">
                            <div class="imgPerch">
                                <img :src="imgFomate(item.pic)" class="fadeIn" height="200" width="200">
                            </div>
                            <div class="top">
                                <span>TOP</span><span v-html="(index+1).toString().length>1?(index+1):'0'+(index+1)"></span>
                            </div>
                        </div>
                        <div>
                            <div class="title">
                                <div class="shoplabel" v-if="item.mallDesc!='淘宝'">
                                    <img src="">
                                </div>
                                <span>{{item.dtitle}}</span>
                            </div>
                            <div class="lable" style="margin-bottom: 12px;">
                                <div class="coupon" style="display: inline-flex;">
                                    <span>券</span>{{item.quanJine}}元
                                </div>
                            </div>
                            <div class="price">
                                <span class="currency">¥</span>
                                <span class="juanPrice">{{item.jiage}}</span>
                                <span>券后</span><span class="originPrice">¥{{item.yuanjia}}</span>
                            </div>
                            <div class="btn">近2小时疯抢<span>{{digitalAbbNumber({num:item.salesNum})}}</span><div class="suffix">立即抢</div>
                            </div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>



</div>

</body>

<script>
    (function(){
        var size = (document.body.clientWidth || document.documentElement.clientWidth);
        document.documentElement.style.fontSize = (size > 750 ? 750 : size) / 7.5 + 'px';
    })();



    new Vue({
        el: '#fqList',
        data:{
            cateList:[],
            goodsList:[],
            localGoodsList:[],
            actIndex:0,
            sys:false,
            nowTime:0,
            mins:0,
            ss:0,
            cid:0,
            type:1
        },
        methods:{
            handleCdetailFavorite: function (items) {
                if(_config.jumpGoodsUrl){
                    _config.jumpGoodsUrl(items);
                }
                var params = {
                    site_id:this.sys.uid,
                    auth_id:this.sys.auth_id,
                    pid:this.sys.pid,
                    goodsid:items.goodsid,
                    need_tpwd:1,
                    gid:items.gid,
                    is_auto_quan:1,
                    d_title:items.dtitle,
                    need_short_link:1,
                };

                if(this.sys.channel_id){
                    params.relationId =this.sys.channel_id;
                }

                return new taobaoCode({
                    type:1, // type=>1 商品转链  2 活动转链  3自定义跳转
                    ua:['MicroMessenger','WeiBo'], // 定制 UA  ua => [true]不跳转复制淘口令模式
                    modelType:0 , // 0 => 默认成功失败提示 modelType => 1 超级红包 2 =>会场弹窗 （判断类型 默认不传，用途复制成功提示文案判断）
                    isRedPacket:false, // isRedPacket => true 开启红包流程  isRedPacket=> 关闭红包流程 （是否开启红包弹窗流程）
                    params:params,
                    regCode:/\#(.*?)\#/, //替换正则 默认 #淘口令#
                    template:"优惠已生成，复制本段文字¥#淘口令#¥，打开淘宝APP领券购买",//替换模版
                });
            },
            digitalAbbNumber :function({ num = 0, unit }){
                var param = {};
                var k = 10000,
                    sizes = ['', '万', '亿', '万亿'],
                    i;
                if (num < k) {
                    return num;
                } else {
                    i = Math.floor(Math.log(num) / Math.log(k));
                    param.value = parseFloat((num / Math.pow(k, i)).toFixed(1));
                    param.unit = sizes[i];
                }
                return param.value + (unit || param.unit);
            },
            cateRender:function(){//渲染nav swiper
                mySwiper = new Swiper ('.top-nav', {
                    slidesPerView: 'auto',
                    initialSlide: 1,
                    paginationClickable: true,
                    observer:true,//修改swiper自己或子元素时，自动初始化swiper
                    observeParents:true,//修改swiper的父元素时，自动初始化swiper
                })

            },
            goodsListRender:function(){
                listSwiper = new Swiper ('.card-block', {
                    initialSlide: 1,
                    paginationClickable: true,
                    observer:true,//修改swiper自己或子元素时，自动初始化swiper
                    observeParents:true,//修改swiper的父元素时，自动初始化swiper
                })
            },
            chooseCate:function(index,cid,type){//选择分类
                mySwiper.slideTo(index-2, 1000, false)
                this.actIndex = index;
                this.getGoodsList(cid,type)
                this.cid = cid;
                this.type = type;
            },
            getCateList:function(){//获取分类列表
                var _this = this;
                $.ajax({
                    url:'https://dtkapi.ffquan.cn/dtk_go_app_api/v1/page-goods-ranking-cate',
                    type:"get",
                }).done(function(res){
                    if(res.code == 1){
                        _this.cateList = res.data
                    }
                    setTimeout(function(){
                        _this.cateRender();
                        mySwiper.slideTo(0, 0, false)
                    },10)
                })
            },
            getNowTime:function(){//获取当前时间
                var _this = this;
                $.ajax({
                    url:'https://cmsstatic.dataoke.com/now',
                    type:"get",
                }).done(function(res){
                    res = JSON.parse(res)
                    if(res.status == 0){

                        var time =  res.data.time;

                        var start = new Date(time * 1000);
                        var minute = start.getMinutes();
                        var $nowNode = Math.ceil((minute + 1) / 20);
                        var $nextNode = 20 * $nowNode - 1;
                        if ($nextNode > 59) {
                            $nextNode = 59;
                        }

                        start.setMinutes($nextNode);
                        var $rankTime = start.getTime() + 59000;
                        start = time * 1000;
                        var end = $rankTime;
                        _this.nowTime = end - start;

                        var timer = setInterval(() => {
                            _this.nowTime -= 1000;
                            var du = moment.duration(_this.nowTime, 'ms');
                            _this.mins = du.get('minutes');
                            _this.ss = du.get('seconds');

                            if (_this.nowTime <= 0 && _this.nowTime !== '') {
                                _this.mins = '00';
                                _this.ss = '00';
                                _this.getGoodsList(_this.cid,_this.type);
                                clearInterval(timer)
                                _this.getNowTime();
                                return;
                            }
                        }, 1000);

                    }

                })
            },
            getGoodsList:function(cid,type){//获取商品列表
                cid = cid || 0;
                type = type!=undefined?type:1;
                var _this = this;
                $.ajax({
                    url:'https://dtkapi.ffquan.cn/dtk_go_app_api/v1/page-goods-ranking',
                    type:"get",
                    data:{
                        cId:cid,
                        type:type,
                        app_key: _config.appKey,
                    }
                }).done(function(res){
                    if(res.code == 1){
                        _this.goodsList = res.data.data;
                        _this.sys = (res.data && res.data.sys) ? res.data.sys : null;
                    }
                    else {
                        _this.sys = null;
                    }
                })


            },
            addLocalList:function(cid,type){
                var _this = this;
                cid = cid || 0;
                type = type!=undefined?type:1;

                if(_this.localGoodsList.length<1){
                    var fn = function(){
                        _this.localGoodsList.push(_this.goodsList);
                    }
                    _this.getGoodsList(cid,type,fn);

                }else{
                    for(var i=0; i<_this.localGoodsList.length; i++){


                        if(_this.localGoodsList[i].cid == cid){
                            return false

                        }else{
                            var fn = function(){
                                _this.localGoodsList.push(_this.goodsList)
                            }
                            _this.getGoodsList(cid,type,fn);
                        }

                    }
                }

                // _this.goodsListRender()
            },
            getDateNow:function(){
                var _this = this;
                $.ajax({
                    url:'https://cmsstatic.dataoke.com/now',
                    type:"get",
                }).done(function(res){
                    data = JSON.parse(res).data;
                    var start = new Date(data.time * 1000);
                    var minute = start.getMinutes();
                    var $nowNode = Math.ceil((minute + 1) / 20);
                    var $nextNode = 20 * $nowNode - 1;
                    if ($nextNode > 59) {
                        $nextNode = 59;
                    }


                    start.setMinutes($nextNode);
                    var $rankTime = start.getTime() + 59000;
                    start = data.time * 1000;
                    var end = $rankTime;

                    // setDownTime(end - start);
                    // clearInterval(timerRef.current)
                    // enterDownTime()
                })
            },
            imgFomate:function(img){
                if(img.indexOf('http')!='-1'){
                    return img+'_310x310.jpg'
                }else{
                    return 'https:'+img+'_310x310.jpg'
                }
            }
        },
        mounted:function(){
            this.getCateList();
            this.cateRender();
            // this.getDateNow();
            this.getGoodsList();
            this.getNowTime();
        }
    })
</script>



</html>
